<%@ page contentType="text/html; charset=UTF-8"%>
<section id="login" class="main_block_color shadow">
    <%  String path = request.getContextPath();
        
        if (request.getAttribute("errorLogin") != null) {
            out.print("<p class=\"exception_bground\">" + request.getAttribute("errorLogin").toString() + "</p>");
            request.removeAttribute("errorLogin");
        }
        
        if (request.getSession().getAttribute("user") != null) {
            out.print("<p>" + request.getSession().getAttribute("user").toString()
                    + ", добро пожаловать в систему!</p>");
    %>
    <a id="profile" class="button" href="<%=path + "?action=viewProfile&id="%>">Профиль</a>
    <a id="logout" class="button" href=" # ">Выход</a>
    <%        
    } else {
    %>
    <form id="authorization_form" method="post" action="<%=path + "?action=login"%>" >
        <table>
            <tr>
                <th>Логин</th>
                <td><input type="text" name="username" autocomplete="on" required><br/></td>
            </tr>
            <tr>
                <th>Пароль</th>
                <td><input type="password" name="password" required></td>
            </tr>
            <tr>
                <td colspan="2" align="right" >
                    <input type="submit" name="enter" value="Вход" class="button">
                </td>
            </tr>
        </table>
    </form>
    <% }        
    %>
</section> <!--login-->